package com.bank.dto;

import com.bank.annotation.ValidAccountType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

@Data
@ApiModel(description = "开户时传递的账户数据")
public class AccountDTO {
    @ApiModelProperty("用户ID")
    private Long userId;

    @ApiModelProperty("账户类型 1-储蓄账户 2-信用账户")
    @ValidAccountType
    private Integer accountType;

    @ApiModelProperty("账户开户余额")
    @DecimalMin(value = "0.01", message = "账户余额必须大于0.01元")
    @DecimalMax(value = "1000000", message = "账户余额必须小于1000000元")
    private BigDecimal balance;

    @ApiModelProperty("账户支付密码")
    @Pattern(regexp = "\\d{6}", message = "密码必须为6位数字")
    private String password;
}
